<?php

namespace Support;

class Log {
    private $filename;

    public function __construct($filename) {
        $this->filename = "log/{$filename}";
    }

    public function write($message) {
        $message = trim($message);
        $date = date('Y-m-d H:i:s');
        $ip = Functions::getIp();
        $log = "[$date][$ip] $message" . PHP_EOL;
        file_put_contents($this->filename, $log, FILE_APPEND);
    }
}
